<?php

namespace app\modules\index\services;

use app\common\services\BaseService;
use app\models\GoodsCategory;

class GoodsCategoryService extends BaseService{

    /**
     * 搜索
     * @param $merchant_id
     * @return array|\yii\db\ActiveRecord[]
     */
    public static function search($merchant_id){
        return GoodsCategory::find()
            ->orderBy(['sort'=>SORT_ASC])
            ->select(['cat_id','cat_name'])
            ->andWhere(['merchant_id'=>$merchant_id,'is_show'=>2])
            ->asArray(true)
            ->all();
    }
}